import path from 'node:path'
import createdata from './createdata.js'
import { __dirname } from '../../main.js'
import { BoxApi } from '../../api/boxapi.js'
/**index定义全局路径选择器*/
export const __PATH = {
    //玩家存档
    "association": path.join(__dirname, "/resources/data/birth/assItem"),
    //用户的宗门数据
    "assPlayer": path.join(__dirname, "/resources/data/birth/assPlayer"),
    "assRelation": path.join(__dirname, "/resources/data/birth/assRelation"),
    "assTreasureVault": path.join(__dirname, "/resources/data/birth/assTreasureVault"),
    "interimArchive": path.join(__dirname, "/resources/data/birth/interimArchive"),
    "generateUncharted": path.join(__dirname, "/resources/data/birth/generateUncharted"),
    "assRelate": path.join(__dirname, "/resources/data/fixed/assRelate"),
    'assProduct': path.join(__dirname, '/resources/data/fixed/assProduct'),
    'assPosition': path.join(__dirname, '/resources/data/fixed/assPosition'),
    'assPoint': path.join(__dirname, '/resources/data/fixed/assPoint'),
    'assDrop': path.join(__dirname, '/resources/data/fixed/assDrop')
}
/** 生成游戏数据*/
class DateIndex {
    constructor() {
        /**图片数据生成,图片还是要生成的,可以配置自己的帮助图*/
        /**可以自己写一个获得所有图片名的算法*/
        createdata.generateImg({
            path: ['help', 'map', 'user/bag', 'user/equipment', 'user/information'],
            name: ['help.png', 'icon.png', 'bag.png', 'equipment.png', 'head.png', 'information.png', 'left.png', 'right.png']
        })
        /**生成yaml配置数据*/
        createdata.moveConfig({})
        try {
            /*** 推送插件数据到box的all表*/
            BoxApi.DataIndex.addListArr({ PATH: __PATH['assProduct'], CHOICE: 'generate_all', NAME: 'all' })
            /*** 推送插件数据到box的point表*/
            BoxApi.DataIndex.addListArr({ PATH: __PATH['assPosition'], CHOICE: 'generate_position', NAME: 'position' })
            BoxApi.DataIndex.addListArr({ PATH: __PATH['assPoint'], CHOICE: 'generate_position', NAME: 'point' })
            BoxApi.DataIndex.addListArr({ PATH: __PATH['assDrop'], CHOICE: 'generate_all', NAME: 'dropsItem' })
        } catch {
            logger.error(`[修仙插件][数据推送失败]`);
        }
    }
}
export default new DateIndex()
